package com.platform.oss;


import com.platform.utils.FileType;
import com.platform.utils.FileUtil;
import org.springframework.web.multipart.MultipartFile;

import java.io.InputStream;
import java.util.Date;

/**
 * 本地存储
 */
public class LocalStorageService extends CloudStorageService  {



    @Override
    public String upload(MultipartFile file) throws Exception {

        String fileName = file.getOriginalFilename();
        fileName = FileUtil.renameToUUID(fileName);

       // FileDO sysFile = new FileDO(FileType.fileType(fileName), "/files/" + fileName, new Date());
        try {
           FileUtil.uploadFile(file.getBytes(), "/data/", "/files/" +fileName);
        } catch (Exception e) {

            return null;
        }


        return null;
    }

    @Override
    public String upload(byte[] data, String path) {


        return null;
    }

    @Override
    public String upload(InputStream inputStream, String path) {


        return null;
    }
}
